<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>格式转换 - 河域分割系统</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('index') }}">河域分割系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('index') }}">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('dashboard') }}">仪表板</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="{{ url_for('data.my_data') }}">我的数据</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('data.upload') }}">上传数据</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('analysis.time_series_analysis') }}">时间分析</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-person-circle"></i> {{ current_user.username }}
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="#">个人资料</a></li>
                            <li><a class="dropdown-item" href="#">设置</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="{{ url_for('auth.logout') }}">退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主内容 -->
    <div class="container my-4">
        <div class="row mb-4">
            <div class="col-md-8">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="{{ url_for('data.my_data') }}">我的数据</a></li>
                        <li class="breadcrumb-item active">格式转换</li>
                    </ol>
                </nav>
                <h2>图像格式转换</h2>
                <p class="text-muted">将TIFF格式图像转换为JPG格式，以便用于深度学习模型</p>
            </div>
            <div class="col-md-4 text-end">
                <a href="{{ url_for('data.my_data') }}" class="btn btn-outline-secondary">
                    <i class="bi bi-arrow-left"></i> 返回我的数据
                </a>
            </div>
        </div>

        <div class="row">
            <div class="col-md-8">
                <div class="card mb-4">
                    <div class="card-header">
                        <h5 class="mb-0">TIFF转JPG转换</h5>
                    </div>
                    <div class="card-body">
                        <form method="post" enctype="multipart/form-data">
                            <div class="mb-3">
                                <label for="file" class="form-label">选择TIFF文件</label>
                                <input type="file" class="form-control" id="file" name="file" accept=".tif,.tiff" required>
                                <div class="form-text">
                                    支持的格式: .tif, .tiff (最大文件大小: 50MB)
                                </div>
                            </div>
                            <div class="mb-3">
                                <div class="form-check">
                                    <input class="form-check-input" type="checkbox" id="preserve_original" name="preserve_original" checked>
                                    <label class="form-check-label" for="preserve_original">
                                        保留原始TIFF文件
                                    </label>
                                </div>
                            </div>
                            <button type="submit" class="btn btn-primary">
                                <i class="bi bi-arrow-repeat"></i> 开始转换
                            </button>
                        </form>
                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5 class="mb-0">格式转换说明</h5>
                    </div>
                    <div class="card-body">
                        <div class="alert alert-info">
                            <h6><i class="bi bi-info-circle me-2"></i>为什么需要转换？</h6>
                            <p>深度学习模型通常使用JPG、PNG等常见图像格式作为输入。转换TIFF文件可以使其与模型兼容。</p>
                        </div>
                        <h6>转换过程中会进行以下处理：</h6>
                        <ul>
                            <li>对于多波段图像，会选择前三个波段作为RGB通道</li>
                            <li>如果波段数不足3个，会自动转换为适当的灰度或RGB格式</li>
                            <li>转换后的JPG图像采用95%的质量保存，以保持图像细节</li>
                        </ul>
                        <h6>注意事项：</h6>
                        <ul>
                            <li>转换过程可能会损失部分影像信息，特别是对于多光谱图像</li>
                            <li>如果原始TIFF影像体积较大，转换可能需要一些时间</li>
                            <li>转换后的JPG文件会自动添加到您的数据列表中</li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card mb-4">
                    <div class="card-header">
                        <h5 class="mb-0">支持的操作</h5>
                    </div>
                    <div class="card-body">
                        <div class="d-grid gap-2">
                            <a href="{{ url_for('data.upload') }}" class="btn btn-outline-primary">
                                <i class="bi bi-cloud-upload"></i> 上传新数据
                            </a>
                            <a href="{{ url_for('data.my_data') }}" class="btn btn-outline-primary">
                                <i class="bi bi-images"></i> 查看我的数据
                            </a>
                            <a href="{{ url_for('analysis.time_series_analysis') }}" class="btn btn-outline-primary">
                                <i class="bi bi-graph-up"></i> 时间序列分析
                            </a>
                        </div>
                    </div>
                </div>
                <div class="card">
                    <div class="card-header">
                        <h5 class="mb-0">批处理功能</h5>
                    </div>
                    <div class="card-body">
                        <p>需要转换多个TIFF文件？</p>
                        <p>您可以使用ZIP压缩包上传多个TIFF文件进行批量转换。</p>
                        <p class="text-muted">注意：批处理功能即将开放，敬请期待。</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="bg-dark text-white py-4 mt-5">
        <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <h5>河域分割系统</h5>
                    <p>基于深度学习的河域分割与分析平台</p>
                </div>
                <div class="col-md-3">
                    <h5>链接</h5>
                    <ul class="list-unstyled">
                        <li><a href="{{ url_for('index') }}" class="text-white">首页</a></li>
                        <li><a href="{{ url_for('dashboard') }}" class="text-white">仪表板</a></li>
                        <li><a href="{{ url_for('data.my_data') }}" class="text-white">我的数据</a></li>
                    </ul>
                </div>
                <div class="col-md-3">
                    <h5>账户</h5>
                    <ul class="list-unstyled">
                        <li><a href="#" class="text-white">个人资料</a></li>
                        <li><a href="#" class="text-white">设置</a></li>
                        <li><a href="{{ url_for('auth.logout') }}" class="text-white">退出登录</a></li>
                    </ul>
                </div>
            </div>
            <hr>
            <div class="text-center">
                <p>&copy; 2023 河域分割系统. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html> 